package com.imooc.demo.controller;

import com.imooc.demo.entity.QkcVideo;
import com.imooc.demo.service.QkcVideoService;
import org.apache.log4j.spi.LoggerFactory;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by qukoucai001 on 2019/3/14.
 */
@RestController
public class HelloController {

    private static final Logger logger = org.slf4j.LoggerFactory.getLogger(HelloController.class);

    @Autowired
    QkcVideoService qkcVideoService;



    @PostMapping("/hello")
    public String hello(@RequestBody QkcVideo video){
        logger.info("video:"+video);
        int i = qkcVideoService.updateByPrimaryKeySelective(video);
        return String.valueOf(i);
    }


    @GetMapping("/selectByPrimaryKey")
    public String selectByPrimaryKey(Long videoId){
        QkcVideo video = qkcVideoService.selectByPrimaryKey(videoId);
        logger.info("video:"+video);
        return "ok";
    }
}
